/**
* 
* Copyright [2007] [Sunny Liu]
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*   Unless required by applicable law or agreed to in writing, software
*   distributed under the License is distributed on an "AS IS" BASIS,
*   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*   See the License for the specific language governing permissions and
*   limitations under the License.
*/
package ${appConfig.outputPackageName}.web.view;

import java.util.Locale;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.support.WebApplicationObjectSupport;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.ViewResolver;


public class FlexXMLViewResolver extends WebApplicationObjectSupport implements
		ViewResolver {

	private static Logger log = LoggerFactory.getLogger(FlexXMLViewResolver.class);
	private FlexXMLView view = null;
	
	/**
	 * 
	 */
	public FlexXMLViewResolver() {
		super();		
	}

	/* (non-Javadoc)
	 * @see org.springframework.web.servlet.ViewResolver#resolveViewName(java.lang.String, java.util.Locale)
	 */
	public View resolveViewName(String arg0, Locale arg1) 
	throws Exception 
	{	
		if(log.isDebugEnabled()) log.debug("Resolving View for " + arg0);
		if(arg0.equals(FlexXMLView.class.getName())){
			return view;
		}
		return null;		
	}
	

	/**
	 * @return Returns the view.
	 */
	public FlexXMLView getView() {
		return view;
	}
	/**
	 * @param view The view to set.
	 */
	public void setView(FlexXMLView view) {
		this.view = view;
	}
}
